package A13;

import javax.security.auth.Subject;
import java.util.List;

public class Department {
    private String deptName; // 系名称
    private List<Instructor> instructors; // 关联：1~*个教师
    private List<Subject> subjects; // 关联：1~*门课程

    public Department(String deptName, List<Instructor> instructors, List<Subject> subjects) {
        this.deptName = deptName;
        this.instructors = instructors;
        this.subjects = subjects;
    }

    // 添加教师（双向关联）
    public void addInstructor(Instructor instructor) {
        instructors.add(instructor);
        instructor.setDepartment(this);
    }

    // 添加课程
    public void addSubject(Subject subject) {
        subjects.add(subject);
    }

    // getter/setter
    public String getDeptName() {
        return deptName;
    }

    public List<Instructor> getInstructors() {
        return instructors;
    }

    public List<Subject> getSubjects() {
        return subjects;
    }
}